package org.friut.util.collection;

import java.util.LinkedList;

public class LimitedLinkedList<E> extends LinkedList<E> {

	private static final long serialVersionUID = -2033652529595912277L;

	private int limit = 10;
	
	public LimitedLinkedList(int limit) {
		this.limit = limit;
	}
	
	@Override
	public boolean add(E e) {
		super.add(e);
		while (size() > limit) {
			super.remove();
		}
		return true;
	}
}
